const mongoose = require('mongoose')

const Schema  = mongoose.Schema
// 群用户
const GroupUserType = {
    groupId: { type: Schema.Types.ObjectId, ref: 'group' },  // 群id
    userId: { type: Schema.Types.ObjectId, ref: 'user' },  // 用户id
    time: Date,
    state: { type: Number }  // 状态（0:申请中，1:已为加入该群，2:未加入群）
}

const GroupUserModel = mongoose.model('group_user', new Schema(GroupUserType))

module.exports = GroupUserModel